<template>
    <div>
        <div class="title-box" v-if="title">
            <div class="block"></div>
            <div class="text">{{ title }}</div>
        </div>
        <div class="table-container">
            <div v-for="(line,index) in data" :key="index" class="line">
                <div class="text" v-for="(item,j) in line" :key="j">
                    <div class="box"
                         :style="{width:item.width+'px',fontWeight:item.fontWeight,color:item.color,textAlign:item.align,paddingLeft:item.align==='left'?'20px':0}">
                        {{ item.value }}
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
    export default {
        name: 'cc-table',
        props: {
            title: {
                type: String,
                default: ""
            },
            data: {
                type: Array,
                default: [
                    [{value: "客户类型", width: 124, align: "left"}, {value: "次数", width: 99}, {value: "次数", width: 90}],
                    [{value: "银行汇总", width: 124, align: "left"}, {value: "1", width: 99}, {value: "0", width: 90}],
                    [{value: "传统银行", width: 124, align: "left"}, {value: "2", width: 99}, {value: "2", width: 90}],
                ]
            }
        }
    }
</script>

<style scoped lang="scss">
  .title-box {
    display: flex;
    align-items: center;
    margin-bottom: 9.0px;

    .block {
      width: 2px;
      height: 12.0px;
      background-color: #3170FF;
      margin-right: 2px;
    }

    .text {
      color: #001850;

    }
  }

  .table-container {
    .line {
      display: flex;
      min-height: 28.0px;
      align-items: center;
      padding: 7.0px 0;
      box-sizing: border-box;
      border-bottom: 1px solid rgba(148, 148, 156, 0.40);
    }

    .line:last-of-type {
      border-bottom: none;
    }

    .text {
      color: #001850;
      flex-shrink: 0;
      text-align: center;
      font-size: 10.0px;
    }

    .line:first-of-type {
      font-weight: bold;
    }

    .line:nth-child(odd) {
      color: #001850;
      background-color: rgba(136, 173, 255, 0.1);

    }

    .line:nth-child(even) {
      background-color: rgba(136, 173, 255, 0.05);
    }
  }
</style>
